import javax.swing.*;
import java.awt.*;
import java.util.Random;
import java.awt.Font;
public class crushpython {
    private static final String[] TIPS = {
            "记得吃早饭~",
            "记得多加衣服",
            "阴天记得带伞",
            "保持天天的好心情哦",
            "岁寒，时深，添衣，想我"
    };



    private static void createTipwindow() {
        Random rand = new Random();
        JFrame frame = new JFrame("温馨提示");
        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        frame.setSize(300, 100);
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        int x = rand.nextInt(screenSize.width - 300);
        int y = rand.nextInt(screenSize.height - 150);
        frame.setLocation(x, y);

        String tip = TIPS[rand.nextInt(TIPS.length)];
        JLabel label = new JLabel(tip, SwingConstants.CENTER);
        label.setFont(new Font("微软雅黑", Font.PLAIN, 16));
        frame.add(label);

        Color[] colors = {
                new Color(255, 200, 200),
                new Color(200, 255, 200),
                new Color(200, 200, 255),
                new Color(255, 165, 0),
        };
        frame.getContentPane().setBackground(colors[rand.nextInt(colors.length)]);
        frame.setVisible(true);
        Timer timer = new Timer(3000, e -> frame.dispose());
        timer.setRepeats(false);
        timer.start();
    }

    static void main() {
        Timer timer = new Timer(2000,e ->  SwingUtilities.invokeLater(() -> createTipwindow()));
        timer.setRepeats(true);
        timer.start();

    }
}
